<template>
    <!-- 放置html代码 -->
    <div>
        <el-form label-width="auto" style="max-width: 600px">
            <el-form-item label="用户名">
                <el-input v-model="account" />
            </el-form-item>
            <el-form-item label="密码">
                <el-input v-model="password" />
            </el-form-item>
            <el-form-item label="">
                <el-alert :title="tip" type="reeor" v-show="showTip" />
            </el-form-item>
            <el-form-item>
                <el-button type="primary">登录</el-button>
                <el-button>重置</el-button>
            </el-form-item>

        </el-form>
    </div>

</template>

<script>
// <!-- 放置js代码 -->
import { ref, watch } from "vue"
export default {
    name: "Login",
    components: {
    },
    setup() {
        const account = ref("")
        const password = ref("")
        const tip = ref("")
        const showTip = ref(false)

        watch(password,(newValue, oldValue)=>{
            if(newValue.length < 6){
                tip.value = "密码长度不能小于6"
                showTip.value = true
            }else{
                tip.value = ""
                showTip.value = false
            }
        })

        return {
            account,
            password,
            tip,
            showTip
        }
    }
}

</script>

<style>
/* <!-- 放置css样式代码 --> */
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>